﻿using System.Collections.Generic;
using System.ComponentModel;
using PTop.Domain.Entity.Questionnaire;

namespace PTop.Web.Areas.Questionnaire.Models
{
    public class QnStatisticsModel
    {
        public string F_QuestionId { get; set; }
        public QnQuestionEntity QnQuestion { get; set; }
        /// <summary>
        /// 问题题型,1=单选,2=多选,3=评分
        /// </summary>
        public int F_Type { get; set; }

        [DisplayName("问题题型")]
        public string F_TypeName
        {
            get
            {
                switch (F_Type)
                {
                    case 1: return "单选";
                    case 2: return "多选";
                    case 3: return "评分";
                }
                return "未知";
            }
        }
        /// <summary>
        /// 
        /// </summary>
        [DisplayName("问卷标题")]
        public string F_PaperTitle { get; set; }
        /// <summary>
        /// 
        /// </summary>
        [DisplayName("题目")]
        public string F_Question { get; set; }
        /// <summary>
        /// 排序
        /// </summary>
        [DisplayName("排序")]
        public int F_OrderId { get; set; }
        /// <summary>
        /// 答题总数
        /// </summary>
        [DisplayName("答题总数")]
        public int F_AnswerCont { get; set; }
        [DisplayName("选项数")]
        public int F_OptionCont { get; set; }

        [DisplayName("选项1")]
        public int F_Option1 { get; set; }

        [DisplayName("选项2")]
        public int F_Option2 { get; set; }

        [DisplayName("选项3")]
        public int F_Option3 { get; set; }

        [DisplayName("选项4")]
        public int F_Option4 { get; set; }

        [DisplayName("选项5")]
        public int F_Option5 { get; set; }

        [DisplayName("选项6")]
        public int F_Option6 { get; set; }

        [DisplayName("选项7")]
        public int F_Option7 { get; set; }

        [DisplayName("选项8")]
        public int F_Option8 { get; set; }

        [DisplayName("选项9")]
        public int F_Option9 { get; set; }

        [DisplayName("选项10")]
        public int F_Option10 { get; set; }

        public int[] GetOptions()
        {
            var list = new List<int>();
            for (var i = 0; i < F_OptionCont; i++)
            {
                if (i == 0) list.Add(F_Option1);
                if (i == 1) list.Add(F_Option2);
                if (i == 2) list.Add(F_Option3);
                if (i == 3) list.Add(F_Option4);
                if (i == 4) list.Add(F_Option5);
                if (i == 5) list.Add(F_Option6);
                if (i == 6) list.Add(F_Option7);
                if (i == 7) list.Add(F_Option8);
                if (i == 8) list.Add(F_Option9);
                if (i == 9) list.Add(F_Option10);
            }
            return list.ToArray();
        }
    }
}